﻿using System;

namespace AspectIntercept
{
    [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = true)]
    public class PostProcessAttribute : Attribute
    {
        public IPostProcessor Processor { get; private set; }

        public PostProcessAttribute(Type postProcessorType)
        {
            this.Processor = Activator.CreateInstance(postProcessorType) as IPostProcessor;
            if (this.Processor == null)
                throw new ArgumentException(String.Format("The type '{0}' does not implement interface IPostProcessor", postProcessorType.Name, "processorType"));
        }
    }
}
